﻿Imports DTO
Public Class ChiTietQuyenDAO
    Public Function LayDSCTQuyenTuMaLoaiTKDAO(ByVal _maLoaiTK As Integer) As List(Of ChiTietQuyenDTO)

        Dim _listCTQuyen As New List(Of ChiTietQuyenDTO)

        Dim sql As String
        sql = "select * "
        sql &= "from Quyen q full join ChiTietQuyen ctq on q.MaCTQuyen = ctq.MaCTQuyen "
        sql &= "where q.MaLoaiTK = " & _maLoaiTK

        Dim dt As New DataTable()
        dt = DataProvider.LoadSQL(sql)

        For Each row As DataRow In dt.Rows
            Dim _maCTQuyen As Integer = Integer.Parse(row("MaCTQuyen").ToString())
            Dim _sQuyen As String = row("Quyen").ToString()
            Dim _sMoTa As String = row("MoTa").ToString()
            Dim _chiTietQuyenDTO As New ChiTietQuyenDTO(_maCTQuyen, _sQuyen, _sMoTa)

            _listCTQuyen.Add(_chiTietQuyenDTO)

        Next
        Return _listCTQuyen

    End Function
End Class
